Skip to content

Conversation

tvernum
Copy link
Contributor

@tvernum tvernum commented Sep 25, 2025

In audit logs we redact certain fields from the body of rest requests.

This commit changes the way we redact fields in the reindex request. Previously the only form of redaction we supported was total removal of fields, however that can be problematic when an admin wants to know whether a field was supplied or not.

Here we change the way we redact requests for reindexing to replace fields with ::es-redacted:: instead of removing them.

In audit logs we redact certain fields from the body of rest requests.

This commit changes the way we redact fields in the reindex request.
Previously the only form of redaction we supported was total removal
of fields, however that can be problematic when an admin wants to know
whether a field was supplied or not.

Here we change the way we redact requests for reindexing to replace
fields with `::es-redacted::` instead of removing them.
@tvernum tvernum added >enhancement :Security/Audit X-Pack Audit logging auto-backport Automatically create backport pull requests when merged v9.2.0 v8.19.5 v9.1.5 v9.0.8 v8.18.9 labels Sep 25, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

@elasticsearchmachine elasticsearchmachine added the Team:Security Meta label for security team label Sep 25, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @tvernum, I've created a changelog YAML for you.

Copy link
Member

@PeteGillinElastic PeteGillinElastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with one optional nit. I'll defer to @jfreden to approve.

@Override
public Set<String> getFilteredFields() {
return FILTERED_FIELDS;
return Set.of();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Maybe put an assert false in here, since it would be a mistake to call the method? Or even just make it throw a UOE or something?

Copy link
Contributor

@jfreden jfreden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Might be overkill, but an alternative to this approach is to add a replace function to XContentMapValues

Should be fairly straight forward since we already have the filter method.

@rjernst rjernst added v8.18.8 and removed v8.18.9 labels Sep 25, 2025
@tvernum
Copy link
Contributor Author

tvernum commented Sep 26, 2025

an alternative to this approach is to add a replace function to XContentMapValues

I considered that, and I think it would be helpful, but also potentially a bikeshed, so perhaps it's worth revisiting if we need this a second time.

@tvernum tvernum enabled auto-merge (squash) September 26, 2025 01:32
@tvernum tvernum merged commit 0b876b8 into elastic:main Sep 26, 2025
40 checks passed
tvernum added a commit to tvernum/elasticsearch that referenced this pull request Sep 26, 2025
In audit logs we redact certain fields from the body of rest requests.

This commit changes the way we redact fields in the reindex request.
Previously the only form of redaction we supported was total removal
of fields, however that can be problematic when an admin wants to know
whether a field was supplied or not.

Here we change the way we redact requests for reindexing to replace
fields with `::es-redacted::` instead of removing them.
tvernum added a commit to tvernum/elasticsearch that referenced this pull request Sep 26, 2025
In audit logs we redact certain fields from the body of rest requests.

This commit changes the way we redact fields in the reindex request.
Previously the only form of redaction we supported was total removal
of fields, however that can be problematic when an admin wants to know
whether a field was supplied or not.

Here we change the way we redact requests for reindexing to replace
fields with `::es-redacted::` instead of removing them.
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.19
9.1
8.18
9.0

tvernum added a commit to tvernum/elasticsearch that referenced this pull request Sep 26, 2025
In audit logs we redact certain fields from the body of rest requests.

This commit changes the way we redact fields in the reindex request.
Previously the only form of redaction we supported was total removal
of fields, however that can be problematic when an admin wants to know
whether a field was supplied or not.

Here we change the way we redact requests for reindexing to replace
fields with `::es-redacted::` instead of removing them.
elasticsearchmachine pushed a commit that referenced this pull request Sep 26, 2025
In audit logs we redact certain fields from the body of rest requests.

This commit changes the way we redact fields in the reindex request.
Previously the only form of redaction we supported was total removal
of fields, however that can be problematic when an admin wants to know
whether a field was supplied or not.

Here we change the way we redact requests for reindexing to replace
fields with `::es-redacted::` instead of removing them.
elasticsearchmachine pushed a commit that referenced this pull request Sep 26, 2025
In audit logs we redact certain fields from the body of rest requests.

This commit changes the way we redact fields in the reindex request.
Previously the only form of redaction we supported was total removal
of fields, however that can be problematic when an admin wants to know
whether a field was supplied or not.

Here we change the way we redact requests for reindexing to replace
fields with `::es-redacted::` instead of removing them.
elasticsearchmachine pushed a commit that referenced this pull request Sep 26, 2025
In audit logs we redact certain fields from the body of rest requests.

This commit changes the way we redact fields in the reindex request.
Previously the only form of redaction we supported was total removal
of fields, however that can be problematic when an admin wants to know
whether a field was supplied or not.

Here we change the way we redact requests for reindexing to replace
fields with `::es-redacted::` instead of removing them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged >enhancement :Security/Audit X-Pack Audit logging Team:Security Meta label for security team v8.18.8 v8.19.5 v9.0.8 v9.1.5 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants